package com.tianbao54.springboot.mybatis.mapper;

import com.tianbao54.springboot.mybatis.model.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface UserMapper {

    @Results(value = {
            @Result(id = true, property = "id" , column = "id" , javaType = Integer.class, jdbcType = JdbcType.INTEGER),
            @Result(property = "name" , column = "name" , javaType = String.class , jdbcType = JdbcType.VARCHAR),
            @Result(property = "age" , column = "age" , javaType = Integer.class , jdbcType = JdbcType.INTEGER),
            @Result(property = "address" , column = "address" , javaType = String.class , jdbcType = JdbcType.VARCHAR)
    })
    @Select("select * from t_user where id = #{id}")
    User getUserById (int id);
}
